package com.zuxia.action;

import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.zuxia.iservices.PeopleManagementServicesI;
import com.zuxia.iservices.PositioninfoServicesI;
import com.zuxia.po.Positioninfo;

public class PositioninfoAction extends BaseAction {
	public int ptIid;
	public String dpIid;

	public PositioninfoServicesI positioninfoservices;
	public PeopleManagementServicesI peopleManagementServices;
	
	public void positioninfoShowAll(){
		List<Positioninfo> list =positioninfoservices.showPositioninfo();
		System.out.println(list.size());
		String json = JSONArray.toJSONString(list);
		//返回给客户端
		try {
			getResponse().getWriter().print(json);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	/**
	 * 查询部门对应所有空闲职业，只查询出id和名字
	 * @author 谌华勇
	 *
	 * 2018年11月15日下午2:59:06
	 */
	public void showPositionOnlyIdAndName(){
		System.out.println("查询部门的对应空闲职业"+dpIid);
		String json =peopleManagementServices.selPositionOnlyId_Name(dpIid);
		System.out.println("查询所有职业，只查询出id和名字"+json);
		try {
			getResponse().getWriter().print(json);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void positioninfoShowId(){
		Positioninfo p =positioninfoservices.idshow(ptIid);
		String json = JSONArray.toJSONString(p);
		//返回给客户端
		try {
			getResponse().getWriter().print(json);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("根据职位id查询到的职位json字符串如下！"+json);
	}

	
	public int getPtIid() {
		return ptIid;
	}

	public void setPtIid(int ptIid) {
		this.ptIid = ptIid;
	}

	public PositioninfoServicesI getPositioninfoservices() {
		return positioninfoservices;
	}

	public void setPositioninfoservices(PositioninfoServicesI positioninfoservices) {
		this.positioninfoservices = positioninfoservices;
	}

	public PeopleManagementServicesI getPeopleManagementServices() {
		return peopleManagementServices;
	}

	public void setPeopleManagementServices(PeopleManagementServicesI peopleManagementServices) {
		this.peopleManagementServices = peopleManagementServices;
	}
	public String getDpIid() {
		return dpIid;
	}
	public void setDpIid(String dpIid) {
		this.dpIid = dpIid;
	}

}